//
//  AddressBookContactCell.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 16/12/29.
//  Copyright © 2016年 com.xtion.crm. All rights reserved.
//

#import "AddressBookContactCell.h"

@interface AddressBookContactCell()
{
    HeadImageView *_headImageView;
}
@end

@implementation AddressBookContactCell

-(id)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    
    _headImageView = [[HeadImageView alloc]initWithFrame:CGRectMake(0,0, 40, 40)];
    _headImageView.headImage = [UIImage imageNamed:@"img_defaulthead.png"];
    [self.contentView addSubview:_headImageView];
    
    CGSize s = [NSString charSizeWithSystemFontSize:16];
    _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, s.width*10, s.height)];
    _titleLabel.backgroundColor = [UIColor clearColor];
    _titleLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:_titleLabel];
    
    s = [NSString charSizeWithSystemFontSize:13];
    _contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, s.width*10, s.height)];
    _contentLabel.backgroundColor = [UIColor clearColor];
    _contentLabel.font = [UIFont systemFontOfSize:13];
    _contentLabel.textColor = [UIColor colorWithHex:mcrmSAASUISkinColorTextStyle9b9b9bColor];
    [self.contentView addSubview:_contentLabel];

    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    _headImageView.origin = CGPointMake(10, 0);
    _headImageView.centerY = self.contentView.height/2;
    
    _titleLabel.origin = CGPointMake(_headImageView.right + 10, _headImageView.top);
    _contentLabel.origin = CGPointMake(_headImageView.right + 10, _titleLabel.bottom + 3);
}

-(void)setHeadImage:(UIImage *)headImage
{
    _headImageView.headImage = headImage;
}
@end
